Skip to content

characterization tests and atime overhead guard for [ modularization - #7931

Merged
ben-schwen merged 3 commits into
bracket_modularizationfrom
brk/a1_tests
Nov 3, 2026
Merged

ben-schwen merged 3 commits into
bracket_modularizationfrom
brk/a1_tests

Conversation

@ben-schwen

Copy link
Copy Markdown
Member

Towards #852

This PR is the starting point of modularizing [.

I will build it as stack on top of each other. I moved the tests to a new script since [ is such a central piece that I thought it deserves its own place. Moreover, it gives us the chance to set them as optional.

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.09%. Comparing base (fe94435) to head (2f7421f).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #7931   +/-   ##
=======================================
  Coverage   99.08%   99.09%           
=======================================
  Files          88       88           
  Lines       17429    17429           
=======================================
+ Hits        17270    17271    +1     
+ Misses        159      158    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ben-schwen
ben-schwen added this pull request to stack #7933 October 21, 2026 10:29
@MichaelChirico

Copy link
Copy Markdown
Member

Aside -- are you using gh to manage the stack? Curious how the experience is. I still swear by jj but it doesn't play that nicely with managing the stack on GitHub -- it's trivial to manage the stack locally with jj, but conveying that to GitHub, less so.

@ben-schwen

Copy link
Copy Markdown
Member Author

Aside -- are you using gh to manage the stack? Curious how the experience is. I still swear by jj but it doesn't play that nicely with managing the stack on GitHub -- it's trivial to manage the stack locally with jj, but conveying that to GitHub, less so.

Nah I'm doing it quite old school. I have a development branch where I do everything and push a lot locally. Before pushing to github I cherry-pick and squash manually.

@MichaelChirico

Copy link
Copy Markdown
Member

well consider this my shameless plug for jj, which I've been using exclusively over git for a while now :)

@tdhock

tdhock commented Oct 21, 2026

Copy link
Copy Markdown
Member

you guys don’t use magit ??!! (emacs joke)

@tdhock

tdhock commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

Error on CI is

Error in eval(bysub, xss, parent.frame()) : 
  numeric 'envir' arg not of length one
Calls: <Anonymous> ... system.time -> do.call -> <Anonymous> -> run_bench_mark

To reproduce locally I did

tinfo <- atime::atime_pkg_test_info("~/R/data.table")
tcall <- tinfo$test.call[["DT[i,j,by] per-call overhead for #852"]]
options(datatable.verbose=TRUE)
tres <- eval(tcall)

and I got

i clause present and columns used in by detected, only these subset: [g]
cedta decided 'data.table.7b7f63b04693991e014e245c8d4a0bc6b9dc38c6' wasn't data.table aware. Here is call stack with [[1L]] applied:
[[1]]
eval

[[2]]
eval

[[3]]
atime::atime_versions
…
[[7]]
run_bench_mark

[[8]]
suppressWarnings

[[9]]
withCallingHandlers

[[10]]
eval

[[11]]
eval

[[12]]
bench::mark

[[13]]
eval_one

[[14]]
eval

[[15]]
eval

[[16]]
data.table.7b7f63b04693991e014e245c8d4a0bc6b9dc38c6:::`[.data.table`

[[17]]
`[.data.table`

[[18]]
cedta

Error in eval(bysub, xss, parent.frame()) : 
  numeric 'envir' arg not of length one

This is happening when i is used at same time as by: (the issue does not happen in the other two usages in the test case, because they do not use i with by)

data.table:::`[.data.table`(dt, a > 2L, .(s = sum(v)), by = g)

which calls this code in [.data.table:

            xss = `[.data.table`(x,irows,allbyvars,with=FALSE,nomatch=nomatch,mult=mult,roll=roll,rollends=rollends)
          } else {
            if (verbose) catf("i clause present but columns used in by not detected. Having to subset all columns before evaluating 'by': '%s'\n", deparse(by))
            xss = `[.data.table`(x,irows,nomatch=nomatch,mult=mult,roll=roll,rol

I think the issue is that cedta thinks these recursive calls are not dt-aware? Not sure how to fix.

@ben-schwen

Copy link
Copy Markdown
Member Author

I think the issue is that cedta thinks these recursive calls are not dt-aware? Not sure how to fix.

Yes. I hope my fix works, fingers crossed :D

@github-actions

github-actions Bot commented Oct 24, 2026 •

Copy link
Copy Markdown
  • HEAD=brk/a1_tests much faster for Date-IDate regression in #7213

(Plot image upload to picrd.com failed; download the artifact below to view plots)

Generated via commit 2f7421f

Download link for the artifact containing the test results: ↓ atime-results.zip

Task Duration
R setup and installing dependencies 1 minutes and 50 seconds
Installing different package versions 14 minutes and 33 seconds
Running and plotting the test cases 6 minutes and 11 seconds

@tdhock tdhock left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good

Comment thread .ci/atime/tests.R

# Guards the constant per-call overhead of [.data.table while it is split into modules (#852).
"DT[i,j,by] per-call overhead for #852" = atime::atime_test(
N = 2^seq(0, 14),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
N = 2^seq(0, 14),
N = 2^seq(0, 14),
seconds.limit = 0.1,

max N tested is not very large, so maybe worth increasing the time limit?

image

ben-schwen and others added 3 commits November 1, 2026 22:01
…852)

Pins down behaviour that the upcoming refactor of [.data.table could silently change:
resolution of i/j/by/on/.SDcols/env= in the calling frame (incl. nested closures),
.N shadowing in the caller, early returns, missing() semantics (including arguments substituted to the empty symbol via env=),
forms of i, forms of j with with=FALSE and also forms of by.
joins combined with by=.EACHI/:=/roll, and := forms.
Also covers some previously uncovered lines (mult='error' without duplicates, datatable.join.many=FALSE, := on key column).

Adds an atime test measuring the per-call overhead of [.
Co-authored-by: Toby Dylan Hocking <tdhock5@gmail.com>
@MichaelChirico

Copy link
Copy Markdown
Member

BTW, feel free to submit Approved PRs in any order you'd like by reordering the stack. Another thing I find jj excels at 😉

@ben-schwen
ben-schwen removed this pull request from stack #7933 November 3, 2026 09:15
@ben-schwen
ben-schwen changed the base branch from master to bracket_modularization November 3, 2026 09:16
@ben-schwen
ben-schwen added this pull request to stack #7953 November 3, 2026 09:16
@ben-schwen

Copy link
Copy Markdown
Member Author

BTW, feel free to submit Approved PRs in any order you'd like by reordering the stack. Another thing I find jj excels at 😉

Copy that. I have added an integration branch at the bottom, so we can merge the PRs, one-by-one and do then one final merge of the integration branch

@ben-schwen
ben-schwen merged commit f3ee294 into bracket_modularization Nov 3, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants